package P1线性结构;

import java.util.Iterator;

public class TestArrayDeque {
    public static void main(String[] args) {
        ArrayDeque<Integer> deq1 = new ArrayDeque<>();
        ArrayDeque<Integer> deq2 = new ArrayDeque<>();
        System.out.println(deq1);
        System.out.println(deq2);
        for (int i = 1; i <= 12; i++) {
            deq1.addLast(i);
        }
        System.out.println(deq1);
        System.out.println(deq2);
        System.out.println(deq1.equals(deq1));
        System.out.println(deq1.equals(deq2));
        System.out.println(deq1.equals(new ArrayList<>()));
        for (Integer num : deq1) {
            //num => deq1[i]
            System.out.println(num);
        }
        Iterator<Integer> it = deq1.iterator();
        //只要还能继续遍历
        while (it.hasNext()) {
            //输出当前元素 并移动到下一个元素
            System.out.println(it.next());
        }
        /*
        for (int i = front; i != rear; i = (i + 1) % len) {
            sout(deq1[i]);
        }
        */
    }
}
